﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/*
 *Item - represents an item in a vending machine
 */

namespace vmMachine
{
    class Item
    {
        private double price; //the price of a singel item
        private int amount; //the number of items in stock

        public Item(double pr, int amnt)
        {
            price = pr;
            amount = amnt;
        }

        public double Price
        {
            get
            {
                return price;
            }
            set
            {
                price = value;
            }
        }

        public int Amount
        {
            get
            {
                return amount;
            }
            set
            {
                amount = value;
            }
        }
        //returns true if the item is in stock of false if it is not
        public bool isInStock()
        {
            if (this.amount > 0)
                return true;
            return false;
        }

        //dispense a single item
        public bool dispence()
        {
            if (this.isInStock())
            {
                this.amount--;
                return true;
            }
            return false;
        }
    }
}